import cn.hutool.core.text.csv.CsvData;
import cn.hutool.core.text.csv.CsvReader;
import cn.hutool.core.text.csv.CsvUtil;
import org.junit.Test;
import ruc.utils.IOUtils;

import java.io.*;
import java.text.SimpleDateFormat;
import java.util.Date;

public class App {
    @Test
    public void test1() throws IOException {
        InputStream in = this.getClass().getResourceAsStream("RawData/broker0.csv");


        if (in == null)
            throw new IOException("Creat inputStream failed");

        BufferedReader br = new BufferedReader(new InputStreamReader(in));
        String line;
        for (int i = 0; i < 10; i++) {
            if ((line = br.readLine()) != null) {
                System.out.println(line);
            } else break;
        }

        try {
            br.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Test
    public void test2() {
        InputStream in = this.getClass().getResourceAsStream("RawData/broker0.csv");
        BufferedReader br = new BufferedReader(new InputStreamReader(in));
        CsvReader reader = CsvUtil.getReader();
        CsvData read = reader.read(br);
        System.out.println();
    }

    @Test
    public void test3() {
        System.out.println(this.getClass());
        System.out.println();
    }

    @Test
    public void test4() {
        String[] strings = IOUtils.GetData();
        System.out.println();
    }

    @Test
    public void test5() {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        System.out.println(dateFormat.format(new Date(System.currentTimeMillis())));

    }
    @Test
    public void test6() {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < 5; i++) {
            sb.append("i=").append(i);
            System.out.println(sb);
            sb.setLength(0);
            System.out.println(sb);
        }
    }
    @Test
    public void test7() {
        String[] strings = IOUtils.GetDisorderData(1, 1000000);
        System.out.println();
    }


}
